

def QTimer(self):
# 每隔一段时间做个动作
    self.timer = QTimer()
    self.timer.timeout.connect(self.randomAct)
    self.timer.start(500)
#'''随机做一个动作'''
def randomAct(self):
    if not self.is_running_action:
        self.is_running_action = True
        self.action_images = random.choice(self.pet_images)
        self.action_max_len = len(self.action_images)
        self.action_pointer = 0
    self.runFrame()
#'''完成动作的每一帧'''
def runFrame(self):
    if self.action_pointer == self.action_max_len:
        self.is_running_action = False
        self.action_pointer = 0
        self.action_max_len = 0
    self.setImage(self.action_images[self.action_pointer])
    self.action_pointer += 1
